//
//  VideoPlayer.h
//  THPlayer
//
//  Created by Gollum on 16/9/14.
//  Copyright © 2016年 inveno. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <AVFoundation/AVFoundation.h>
#import "JHMacro.h"
//获取设备的物理宽高
//#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
//屏幕高度
//#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define kTabBarHeight 49
#define kDeviceVersion [[UIDevice currentDevice].systemVersion floatValue]
#define kNavbarHeight ((kDeviceVersion>=7.0)? 64 :44 )
//定义界面的大小
typedef NS_ENUM(NSInteger,VideoPlayerSizeType) {

    VideoPlayerSizeFullScreenType = 0,//全屏
    VideoPlayerSizeSmallScreenType = 1,//小屏
    VideoPlayerSizeDetailScreenType = 2,//详情页面显示
    VideoPlayerSizeRecoveryScreenType = 3//恢复大小


};
//播放状态
typedef NS_ENUM(NSInteger,VideoPlayerStatusChangeType) {

    VideoPlayerStatusLoadingType = 0,//正在加载
    VideoPlayerStatusReadyToPlayType = 1,//开始播放
    VideoPlayerStatusLoadedTimeRangesType = 2//开始缓存
};
//extern与const组合:只需要定义一份全局变量，多个文件共享。
extern NSString *const kVideoPlayerFinishedPlayNotificationKey;//播放完成通知
extern NSString *const KVideoPlayerCloseVideoNotificationKey;//关闭播放视图通知
extern NSString *const kVideoPlayerCloseDetailVideoNotificationKey;//关闭详情播放视图通知
extern NSString *const kVideoPlayerFullScreenBtnNotificationKey;//全屏通知
extern NSString *const kVideoPlayerPopDetailNotificationKey;//退出详情页面通知

//请求成功
typedef void (^PlayerStatusChange)(VideoPlayerStatusChangeType status);
typedef void (^PlayerAnimateFinish) (void);



@interface VideoPlayer : UIView


@property (nonatomic,strong)PlayerStatusChange status;//播放状态

@property (nonatomic,copy)NSString *videoURLStr;//视频链接

@property (nonatomic,assign)VideoPlayerSizeType screenType;

- (instancetype)initWithFrame:(CGRect)frame videoUrlStr:(NSString *)videoUrlStr;

- (void)play;

- (void)setPlayTitle:(NSString *)str;

- (void)toFullScreenWithInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
- (void)reductionWithInterfaceOrientation:(UIView *)view;
-(void)toDetailScreen:(UIView *)view;
-(void)toSmallScreen;
-(void)releaseWMPlayer;
-(void)colseTheVideo:(UIButton *)sender;

@end
